<template>
  <div>
    <el-container class="container">
      <el-aside width="200px">
        <el-row class="tac">
          <el-col :span="24" class="page-nav">
            <h3 class="logo"><router-link to='/'>小U商城后台</router-link></h3>
            <el-menu
              default-active="0"
              background-color="#262a32"
              class="el-menu-vertical-demo"
              text-color="rgb(204, 204, 204)"
            >
              <el-menu-item index="0">
                <i class="el-icon-menu"></i>
                <span slot="title">首页</span>
              </el-menu-item>
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>系统设置</span>
                </template>
                <el-menu-item @click="change('menu')">
                  <template slot="title">菜单管理</template>
                </el-menu-item>
                <el-menu-item @click="change('role')">
                 <template slot="title">角色管理</template>
                </el-menu-item>
                <el-menu-item @click="change('admin')">
                 <template slot="title">管理员管理</template>
                </el-menu-item>
              </el-submenu>
              <el-menu-item index="2" @click="change('category')">
                <i class="el-icon-menu"></i>
                <span slot="title">商品分类</span>
              </el-menu-item>
              <el-menu-item index="3" @click="change('goods')">
                <i class="el-icon-document"></i>
                <span slot="title">商品管理</span>
              </el-menu-item>
              <el-menu-item index="4">
                <i class="el-icon-setting"></i>
                <span slot="title">导航四</span>
              </el-menu-item>
            </el-menu>
          </el-col>
        </el-row>
      </el-aside>
      <el-container>
        <el-header>{{$store.state.age}}</el-header>
        <div class="cate">
          <label>一级分类</label>
          <select name="" id="" v-model="proId">
            <option v-for="(pro, index) in pros" :key="index" :value="pro.id">{{pro.text}}</option>
          </select>
          <br>
          <label>二级分类</label>
          <select name="" id="" v-model="cityId">
            <option v-for="(city, index) in citys[proId].data" :key="index" :value="index">{{city}}</option>
          </select>
        </div>
        
        <router-view></router-view>
        <!-- <el-footer>Footer</el-footer> -->
      </el-container>
    </el-container>
  </div>
</template>
<script>
export default {
  name: "index",
  data() {
    return {
      proId: 0,
      cityId: '',
      pros: [
        {id: 0, text: '河南省'},
        {id: 1, text: '河北省'},
        {id: 2, text: '浙江省'}
      ],
      citys: [
        {
          superId: 0,
          data: ['郑州市','洛阳','开封','周口','新乡']
        },
        {
          superId: 1,
          data:['石家庄','衡水','邯郸']
        },
        {
          superId: 2,
          data:['杭州','金华','丽水','温州']
        }
      ]
    };
  },
  methods: {
    change(target) {
      this.$router.push(`/index/${target}`);
    }
  }
};
</script>
<style lang="">
.container {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}
.page-nav{
    height: 100vh;
    background-color: #262a32;
    overflow: hidden;
}
.page-nav .el-menu{
    border-right: 0;
}
.page-nav h3{
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    color: #fff;
    background-color: #444;
    white-space: nowrap;
    overflow: hidden;
    font-weight: normal;
    letter-spacing: 3px;
}
.cate {
  width: 300px;
}
</style>